//
//  ESTActivityListTableViewCell.m
//  ESTSCRMAPP
//
//  Created by 李贤立 on 2018/10/16.
//  Copyright © 2018年 Capfer. All rights reserved.
//

#import "ESTActivityListTableViewCell.h"
#import "ESTActivityModel.h"
#import "UIButton+WebCache.h"
#import "TYZImagePlayView.h"
@interface ESTActivityListTableViewCell ()
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *dateLabel;
@property (weak, nonatomic) IBOutlet UILabel *themeText;
@property (weak, nonatomic) IBOutlet UILabel *themeLabel;
@property (weak, nonatomic) IBOutlet UILabel *addressText;
@property (weak, nonatomic) IBOutlet UILabel *addressLabel;
@property (weak, nonatomic) IBOutlet UILabel *targetText;
@property (weak, nonatomic) IBOutlet UILabel *targetLabel;
@property (weak, nonatomic) IBOutlet UILabel *enclosureText;
@property (weak, nonatomic) IBOutlet UIView *enclosureView;
@property (weak, nonatomic) IBOutlet UILabel *speakText;
@property (weak, nonatomic) IBOutlet UIButton *speakButton;
@property (weak, nonatomic) IBOutlet UIButton *image1Button;
@end

@implementation ESTActivityListTableViewCell

+ (instancetype)creatActivityListTableViewCell:(UITableView *)tableView {
    ESTActivityListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ESTActivityListTableViewCell"];
    if (cell == nil) {
        cell = [[NSBundle mainBundle] loadNibNamed:@"ESTActivityListTableViewCell" owner:nil options:nil].lastObject;
    }
    return cell;
}
- (void)setModel:(ESTActivityModel *)model {
    _model = model;
    self.nameLabel.text= model.ACTIVITY_NAME;
    if (model.ACTIVITY_STARTDATE && model.ACTIVITY_ENDDATE) {
        self.dateLabel.text = [NSString stringWithFormat:@"%@ 至 %@", model.ACTIVITY_STARTDATE, model.ACTIVITY_ENDDATE];
    }
    self.themeLabel.text = model.ACTIVITY_THEME;
    self.addressLabel.text = model.ACTIVITY_PLACE;
    self.targetLabel.text = model.ACTIVITY_TARGET;
    [self.image1Button sd_setImageWithURL:[NSURL URLWithString:model.ACTIVITY_ATTA_URL1] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:Image_PlaceholderImage_Normal]];
}
- (IBAction)didClickSpeakButton:(UIButton *)sender {
    if (self.didClickSpeakBlock) {
        self.didClickSpeakBlock();
    }
}
- (IBAction)didClickImageButton:(UIButton *)sender {
    [TYZImagePlayView imagePlayInFullScreenWithImageURLStringsGroup:@[self.model.ACTIVITY_ATTA_URL1]];
}

@end
